package santeclair.referentiel.optique.model;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import santeclair.lunar.framework.annotation.Code;
import santeclair.lunar.framework.annotation.HashCodeEquals;
import santeclair.lunar.framework.annotation.ToString;
import santeclair.lunar.framework.util.EqualsUtils;
import santeclair.lunar.framework.util.HashCodeUtils;
import santeclair.lunar.framework.util.ToStringUtils;
import santeclair.referentiel.optique.config.Constant;

@Entity
@Table(name = "tr_materiaux_verre", catalog = Constant.SCHEMA_NAME, uniqueConstraints = @UniqueConstraint(columnNames = "code_materiaux_verre"))
public class MateriauxVerre implements java.io.Serializable {

    private static final long serialVersionUID = 1387448155599927893L;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "identifiant_materiaux_verre", unique = true, nullable = false)
    @HashCodeEquals
    @ToString
    private Integer identifiantMateriauxVerre;

    @Code
    @Column(name = "code_materiaux_verre", unique = true, nullable = false, length = 10)
    @HashCodeEquals
    @ToString
    private String codeMateriauxVerre;

    @Column(name = "libelle_materiaux_verre", nullable = false)
    @HashCodeEquals
    @ToString
    private String libelleMateriauxVerre;

    public MateriauxVerre() {
    }

    public Integer getIdentifiant() {
        return this.identifiantMateriauxVerre;
    }

    public void setIdentifiant(Integer identifiantMateriauxVerre) {
        this.identifiantMateriauxVerre = identifiantMateriauxVerre;
    }

    public String getCode() {
        return this.codeMateriauxVerre;
    }

    public void setCode(String codeMateriauxVerre) {
        this.codeMateriauxVerre = codeMateriauxVerre;
    }

    public String getLibelle() {
        return this.libelleMateriauxVerre;
    }

    public void setLibelle(String libelleMateriauxVerre) {
        this.libelleMateriauxVerre = libelleMateriauxVerre;
    }

    @Override
    public String toString() {
        return ToStringUtils.toString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeUtils.hashCode(this);
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsUtils.isEqual(this, obj);
    }

}
